/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, middleware } = app;
  router.get('/', controller.home.index);

  router.post('/api/data/test/clear', controller.global.clearTestData);

  /**
   * 获取行政区域
   */
  router.get('/api/global/cities/get', controller.global.cities);
  router.post('/api/global/cities/get', controller.global.cities);
  /**
   * 获取编码
   */
  router.post('/api/global/pic/create', controller.global.createPic);
  // router.post('/api/global/pic/update', controller.global.updatePic);
  router.post('/api/global/pic/delete', controller.global.deletePic);
  router.post('/api/global/pic/find/many', controller.global.findPicMany);
  /**
   * 图片
   */
  router.post('/api/global/code', controller.global.getCode);
  router.post('/api/global/model', controller.global.getModel);

  /**
   * 上传文件
   */
  // router.post('/api/global/upload',middleware.multipart({ mode: 'file', fileSize: '5mb' }), controller.global.uploadFile);
 // router.get('/api/global/upload', controller.global.upload);
  router.post('/api/global/upload', controller.global.upload);
  router.get('/api/global/download', controller.global.download);
//整理客户 todo 后面要删掉
  router.get('/api/data/edit', controller.global.dataEdit);

  //配置
  router.post('/api/settings/sales/update', controller.settings.updateSalesSetting);
  router.post('/api/settings/sales/find', controller.settings.findSalesSetting);

  require('./router/tenant')(app);
  require('./router/user')(app);
  require('./router/material')(app);
  require('./router/tree')(app);
  require('./router/role')(app);
  require('./router/dynamicLabelRouter')(app);
  require('./router/organization')(app);
  require('./router/procure')(app);
  require('./router/store')(app);
  require('./router/sales')(app);
  require('./router/customer')(app);
  require('./router/dic')(app);
  require('./router/dict')(app);
  require('./router/vendor')(app);
  require('./router/finance')(app);
  require('./router/work')(app);
  require('./router/personnel')(app);
  require('./router/experiment')(app);

};
